<?php

namespace addon\hotel\event;

use addon\hotel\model\OrderCommon as OrderCommonModel;
use addon\hotel\model\HotelMember as HotelMemberModel;

/**
 * 创建订单后添加酒店关注
 */
class OrderCreateHotelMember
{
    /**
     * 传入订单信息
     * @param unknown $data
     */
    public function handle($data)
    {
        $order_model = new OrderCommonModel();
        $order_info = $order_model->getOrderInfo([ [ 'order_id', '=', $data['order_id'] ] ], 'hotel_id,member_id');
        $order_info = $order_info['data'];
        if (!empty($order_info)) {
            //添加店铺关注记录
            $shop_member_model = new HotelMemberModel();
            $res = $shop_member_model->addHotelMember($order_info['hotel_id'], $order_info['member_id'], 0);
            return $res;
        }
    }

}